package ua.pp.pycb6a.tranggui;

import javafx.scene.control.Label;

import org.slf4j.Logger;

public class Messages {

    private Logger logger;

    public Messages(Logger logger) {
        this.logger = logger;

    }

    public void traceIoError(Label label) {
        logger.error("I/O error");
        label.setText("I/O error");
    }

    public void traceWrongUri(Label label) {
        logger.error("Wrong URI");
        label.setText("Wrong URI");
    }

    public void traceGenerationFaild(Label label) {
        logger.error("Generation failed");
        label.setText("Generation failed");
    }

    public void traceSuccess(Label label) {
        logger.warn("Success! Please, check result");
        label.setText("Success! Please, check result");
    }

    public void traceIncorrectOutputFile(Label label) {
        logger.warn("Correct output file is not chosen");
        label.setText("Correct output file is not chosen");
    }

    public void traceSaxError(Label label, String lang, Exception e) {
        logger.warn(String.format("%s is not valid. %s", lang, e.getMessage()));
        label.setText(String.format("%s is not valid. %s", lang, e.getMessage()));
    }

    public void traceEmptyInputText(Label label) {
        logger.warn("Input text is not entered");
        label.setText("Input text is not entered");
    }

    public void traceParserError(Label label) {
        logger.warn("Parser error");
        label.setText("Parser error");

    }
}
